<template>
	<!-- 维修记录条目 -->
	<view class="record-item"> 
		<view class="item-title">
			<view>{{ recordItem.deviceName }}</view>
			<view>{{ recordItem.createTime }}</view>
		</view>
		<view class="item-column">
			<view class="cate">故障设备:</view>
			<view class="cate">{{ recordItem.faultDev }}</view>
		</view>
		<view class="item-column">
			<view class="cate">故障原因:</view>
			<view class="cate">{{ recordItem.faultReason }}</view>
		</view>
		<u-line border-style="dashed" color="#e9e9e9"></u-line>
		<view class="item-state"> 
			<u-button type="primary" size="mini">{{ stateText }}</u-button>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				
			}
		},
		computed:{
			stateText(){
				if(this.recordItem.recordState === 1){
					console.log('stateText:待处理')
					return '待处理'
				}else if(this.recordItem.recordState === 2){
					return '待维修'
				}else if(this.recordItem.recordState === 3){
					return '已完成'
				}else{
					return '未知状态'
				}
			}
		},
		props:{
			recordItem:{
				type:Object,
				default:()=>{}
			}
		}
	}
</script>

<style scoped lang="scss">
	.record-item{
		display: flex;
		flex-direction: column;
		.item-title{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
		}
		.item-column{
			display: flex;
			flex-direction: row;
			
		}
		.item-state{
			display: flex;
			flex-direction: row;
			justify-content: flex-end;
			align-items: center;
		}
	}
</style>
